import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
public class Test04{
		 public static void main(String[] args) { 
		 Scanner in = new Scanner(System.in);
		 int n= in.nextInt(); 
		 Shape shape[]=new Shape[n];
		 for(int i=0;i<n;i++){ 
			 String str=in.next();
			 if(str.equals("rect")){	 
				 shape [i] =new Rectangle(in.nextInt(),in.nextInt());	 
				 Shape.sumAllArea(shape[i]);
				 Shape.sumAllPerimeter(shape[i]);
			 }
			 else {
				 shape[i]=new Circle(in.nextInt());	 
				 Shape.sumAllArea(shape[i]);
				 Shape.sumAllPerimeter(shape[i]);
			 }   
		 }
		 System.out.println(Shape.getSum2());
		 System.out.println(Shape.getSum1());	
		 System.out.println(Arrays.deepToString(shape));
		 for (int i = 0; i < shape.length; i++) {
				System.out.print(shape[i].getClass());
				System.out.print(",");
				System.out.print(shape[i].getClass().getSuperclass());
				System.out.println();		
			}
	 }	
}
abstract class Shape{
    final static double PI=3.14;
	private static  double sum1=0.0;
	private static double sum2=0.0;
	public abstract double getPerimeter();
	public abstract double getArea(); 
	public static double getSum1() {
		return sum1;
	}
	public static void setSum1(double sum1) {
		Shape.sum1 = sum1;
	}
	public static double getSum2() {
		return sum2;
	}
	public static void setSum2(double sum2) {
		Shape.sum2 = sum2;
	}
	public static double sumAllArea(Shape shape){ 
		Shape.sum1=Shape.sum1+shape.getArea();
		 return sum1;
	 }
	 public static double sumAllPerimeter(Shape shape){
		 Shape.sum2=Shape.sum2+shape.getPerimeter();
		 return sum2;
	 } 
}
class Rectangle extends Shape{
	int width;
	int length;
	Rectangle(int width,int length){
		this.width=width;
		this.length=length; 
	}
	public double getPerimeter(){
		double c=2*(width+length);
		return c;
	}
	public double getArea(){
		double s=width*length;
		return s;
	}
	 
	public String toString() {
		return "Rectangle [width=" + width + ", length=" + length + "]";
	}
}
class Circle extends Shape{
	int radius;
	Circle(int radius){
		this.radius=radius;
	}
	public double getPerimeter(){
		double c=0; 
		return  c=(double) (2*super.PI*radius);	
	}
	public double getArea(){
		double s=0;
		return (double)(super.PI*radius*radius);
	}
	public String toString() {
		return "Circle [radius=" + radius + "]";
	}
}
 